package com.example.everying.model.entity.chat;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import lombok.Data;
import org.springframework.data.annotation.Id;

import javax.validation.constraints.NotNull;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @program: everything
 * @description: 双人会话实体类
 * @author: szy
 * @create: 2025-05-19
 **/
@Data
@TableName("chat_conversation")
public class ChatConversationEntity implements Serializable {

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @NotNull(message = "id不能为空")
    @ApiModelProperty(value = "会话ID")
    private String id;

    @ApiModelProperty(value = "用户1ID")
    @NotNull(message = "用户1ID不能为空")
    private String user1Id;

    @ApiModelProperty(value = "用户2ID")
    @NotNull(message = "用户2ID不能为空")
    private String user2Id;

    @ApiModelProperty(value = "最后消息ID")
    private String lastMessageId;

    @ApiModelProperty(value = "上次记录ID（撤回用）")
    private String lastRecordId;

    @ApiModelProperty(value = "用户1的未读消息数")
    private int user1UnreadCount;

    @ApiModelProperty(value = "用户2的未读消息数")
    private int user2UnreadCount;

    @ApiModelProperty(value = "用户1是否置顶，0：不置顶，1：置顶")
    private boolean user1IsPinned;

    @ApiModelProperty(value = "用户2是否置顶，0：不置顶，1：置顶")
    private boolean user2IsPinned;

    @ApiModelProperty(value = "用户1是否删除，0：未删除，1：已删除")
    private boolean user1IsDeleted;

    @ApiModelProperty(value = "用户2是否删除，0：未删除，1：已删除")
    private boolean user2IsDeleted;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;

}
